package com.timesheet.gui.efforttracker.composite;

import org.eclipse.swt.SWT;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.Section;
import org.eclipse.swt.widgets.Table;

public class SectionWSRComposite extends Composite {
	
	private final FormToolkit toolkit = new FormToolkit(Display.getCurrent());

	

	public SectionWSRComposite(Composite parent, int style) {
		super(parent, style);
		addDisposeListener(new DisposeListener() {

			public void widgetDisposed(DisposeEvent e) {
				toolkit.dispose();
			}
		});
		toolkit.adapt(this);
		toolkit.paintBordersFor(this);
		setLayout(new GridLayout(1, false));
		Section sctnWSR = toolkit.createSection(this, Section.TWISTIE | Section.TITLE_BAR);
		sctnWSR.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
		toolkit.paintBordersFor(sctnWSR);
		sctnWSR.setText("Quick View WSR"); 
		sctnWSR.setExpanded(true);
		
		WSRTableComp tableComp = new WSRTableComp(sctnWSR, SWT.NONE);
		Table table = tableComp.getTableViewer().getTable();
		GridData gd_table = new GridData(SWT.FILL, SWT.TOP, true, true, 1, 1);
		gd_table.heightHint = 245;
		table.setLayoutData(gd_table);
		toolkit.adapt(tableComp);
		toolkit.paintBordersFor(tableComp);
		sctnWSR.setClient(tableComp);
	}

	

}
